<?php
namespace app\common\model;
use app\common\traits\Models;
use think\Model;
use think\facade\{
    App,Request,Config
};
class Link extends Model
{
    use Models;
    protected $readonly = [];
    protected $auto     = [];
    protected $insert   = [];
    protected $update   = [];
//获取器====================================================================================//
    public function getCreateTimeAttr($value)
    {
        return com_time_format($value);
    }
    public function getUpdateTimeAttr($value)
    {
        return com_time_format($value);
    }
    public function getLinkTypeAttr($value)
    {
        return c('type.link_type',$value);
    }
/*关联模型=================================================================================*/
   	public function LinkCat()
    {
        return $this->belongsTo('LinkCat','cat_id','id');
    }
   	

    /**
     * 删除
     * @param  [type] $id [description]
     * @return [type]     [description]
     */
    public function del($id){
        if(!is_array($id)) $id = [$id];
        $id = implode(",",$id);
        $this::destroy($id,true);
        return true;
    }

}
